package com.jr.dao.impl;

import com.jr.dao.UsersDao;
import com.jr.pojo.Users;
import com.jr.util.DBHelper;
import com.jr.util.PageHelper;
import org.apache.catalina.User;

import java.util.ArrayList;

public class IUsersDaoImpl implements UsersDao {
    DBHelper db = new DBHelper();
    @Override
    // 根据账号密码查询用户（登录功能）
    public Users findByAccountAndPassword(String account, String password) {
        String sql1 = "select * from users where account=? and password=?";
       ArrayList<Users> list = db.dtQuery(sql1,Users.class,account,password);
       return  list.get(0);
    }

    @Override
    /*通过账号拿对象*/
    public Users selectUsers(String account) {
        System.out.println("dao层拿到账号了吗？"+account);
        String sql = "select * from users where account = ?";

        ArrayList<Users> list = db.dtQuery(sql,Users.class,account);
        System.out.println("sql语句"+sql);
        System.out.println("dao对象"+list);
        return list.get(0);
    }



}
